const { query } = require("../db/query")
module.exports = {
  // 领养
  adoptPet: async (pet_id, adopter_id) => {
    // 调用query发送sql语句到mysql进行注册用户
    return await query("update petinformation set adopter_id =?,pet_give_status = 'true' where pet_id =?", [adopter_id, pet_id])
  },
  // 查询领养
  queryAdopt: async (pet_id) => {
    // 调用query发送sql语句到mysql进行注册用户
    return await query("select * from petinformation where pet_id =?", [pet_id])
  },
  // 成功领养
  adoptPetSuccess: async (pet_id) => {
    // 调用query发送sql语句到mysql进行注册用户
    return await query("update petinformation set pet_collar_status = 'true' where pet_id =?", [pet_id])
  },
  // 取消领养
  removeAdopt: async (pet_id) => {
    // 调用query发送sql语句到mysql进行注册用户
    return await query("update petinformation set pet_give_status = 'false',adopter_id =NULL where pet_id =?", [pet_id])
  },
}